<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html,body{
            width: 100%;
            height: 100%;
        }
        .box{
            width: 300px;
            height: 200px;
            /* background-color: green; */
            margin: auto;
            text-align: center;
        }
        button,input{
            margin-top: 10px;
        }
    </style>
</head>
<body>
    <div class="box">
        <input type="text" name="item" value="北京市"><br>
        <input type="text" name="item" value="朝阳区"><br>
        <button id="btn">传参</button>
    </div>
</body>
<script>
      function show(v){
        alert(v)
    }
    var item = document.getElementsByName('item')
    var btn = document.getElementById('btn')
  
    btn.onclick = function(){
        for(var i=0;i<item.length;i++){
            show(item[i].value)
        }
    }
</script>
</html>